﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sharpimeter.Model;

namespace UnitTestSharpimeter
{
    [TestClass]
    public class UnitTestProgram
    {
        public string _addressBluetooth = "001C050046AC";
        public string _pin = "199646";

        [TestMethod]
        public void TestConvertBytesToDate()
        {
            OnyxII o2 = new OnyxII(_addressBluetooth, _pin);
           
            Byte[] byteStreamDate = new Byte[] { 0x32, 0x0C, 0x1F, 0x0E, 0x1E, 0x0F };
            DateTime result = o2.ConvertBytesToDate(byteStreamDate);

            DateTime answer = new DateTime(2050, 12, 31, 14, 30, 15);
            Assert.AreEqual(answer, result);
        }

        [TestMethod]
        public void TestConvertDateToBytes()
        {
            OnyxII o2 = new OnyxII(_addressBluetooth, _pin);

            DateTime date = new DateTime(2050, 12, 31, 14, 30, 15);
            Byte[] result = o2.ConvertDateToBytes(date);

            Byte[] byteStreamDate = new Byte[] { 0x32, 0x0C, 0x1F, 0x0E, 0x1E, 0x0F };
            CollectionAssert.AreEqual(byteStreamDate, result);
        }
        
    }
}
